/*
 * Copyright (c) 2021-2025 HPMicro
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 */


#ifndef HPM_OTP_TABLE_H
#define HPM_OTP_TABLE_H

/* OTP WORD OFFSET */
#define OTP_TABLE_HARD_LOCK_OFFSET                         (0U)
#define OTP_TABLE_LIFECYCLE_B_OFFSET                       (1U)
#define OTP_TABLE_TCU_DISABLE_OFFSET                       (1U)
#define OTP_TABLE_DEBUG_DISABLE_OFFSET                     (1U)
#define OTP_TABLE_JTAG_DISABLE_OFFSET                      (1U)
#define OTP_TABLE_PUK_REVOKE_OFFSET                        (1U)
#define OTP_TABLE_LIFECYCLE_A_OFFSET                       (1U)
#define OTP_TABLE_SW_VER_OFFSET                            (3U)
#define OTP_TABLE_DIE_TRACE_OFFSET                         (8U)
#define OTP_TABLE_DEBUG_KEY_OFFSET                         (12U)
#define OTP_TABLE_TSNS_BASE_OFFSET                         (21U)
#define OTP_TABLE_TSNS_SLOPE_OFFSET                        (21U)
#define OTP_TABLE_CHIP_ID_OFFSET                           (64U)
#define OTP_TABLE_USB_PID_OFFSET                           (68U)
#define OTP_TABLE_USB_VID_OFFSET                           (68U)
#define OTP_TABLE_PUBLIC_KEY_HASH_OFFSET                   (80U)
#define OTP_TABLE_UUID_OFFSET                              (88U)
#define OTP_TABLE_EXIP0_KEY_OFFSET                         (96U)
#define OTP_TABLE_MASTER_KEY_OFFSET                        (112U)

/* HARD_LOCK */
#define OTP_TABLE_HARD_LOCK_MASK     (0xFFFFFFFFU)
#define OTP_TABLE_HARD_LOCK_SHIFT    (0x0U)
#define OTP_TABLE_HARD_LOCK_SET(x)   (((uint32_t)(x) << OTP_TABLE_HARD_LOCK_SHIFT) & OTP_TABLE_HARD_LOCK_MASK)
#define OTP_TABLE_HARD_LOCK_GET(x)   (((uint32_t)(x) & OTP_TABLE_HARD_LOCK_MASK) >> OTP_TABLE_HARD_LOCK_SHIFT)

/* LIFECYCLE_B */
#define OTP_TABLE_LIFECYCLE_B_MASK     (0xF0000000U)
#define OTP_TABLE_LIFECYCLE_B_SHIFT    (0x1CU)
#define OTP_TABLE_LIFECYCLE_B_SET(x)   (((uint32_t)(x) << OTP_TABLE_LIFECYCLE_B_SHIFT) & OTP_TABLE_LIFECYCLE_B_MASK)
#define OTP_TABLE_LIFECYCLE_B_GET(x)   (((uint32_t)(x) & OTP_TABLE_LIFECYCLE_B_MASK) >> OTP_TABLE_LIFECYCLE_B_SHIFT)

/* TCU_DISABLE */
#define OTP_TABLE_TCU_DISABLE_MASK     (0x80000U)
#define OTP_TABLE_TCU_DISABLE_SHIFT    (0x13U)
#define OTP_TABLE_TCU_DISABLE_SET(x)   (((uint32_t)(x) << OTP_TABLE_TCU_DISABLE_SHIFT) & OTP_TABLE_TCU_DISABLE_MASK)
#define OTP_TABLE_TCU_DISABLE_GET(x)   (((uint32_t)(x) & OTP_TABLE_TCU_DISABLE_MASK) >> OTP_TABLE_TCU_DISABLE_SHIFT)

/* DEBUG_DISABLE */
#define OTP_TABLE_DEBUG_DISABLE_MASK     (0x20000U)
#define OTP_TABLE_DEBUG_DISABLE_SHIFT    (0x11U)
#define OTP_TABLE_DEBUG_DISABLE_SET(x)   (((uint32_t)(x) << OTP_TABLE_DEBUG_DISABLE_SHIFT) & OTP_TABLE_DEBUG_DISABLE_MASK)
#define OTP_TABLE_DEBUG_DISABLE_GET(x)   (((uint32_t)(x) & OTP_TABLE_DEBUG_DISABLE_MASK) >> OTP_TABLE_DEBUG_DISABLE_SHIFT)

/* JTAG_DISABLE */
#define OTP_TABLE_JTAG_DISABLE_MASK     (0x10000U)
#define OTP_TABLE_JTAG_DISABLE_SHIFT    (0x10U)
#define OTP_TABLE_JTAG_DISABLE_SET(x)   (((uint32_t)(x) << OTP_TABLE_JTAG_DISABLE_SHIFT) & OTP_TABLE_JTAG_DISABLE_MASK)
#define OTP_TABLE_JTAG_DISABLE_GET(x)   (((uint32_t)(x) & OTP_TABLE_JTAG_DISABLE_MASK) >> OTP_TABLE_JTAG_DISABLE_SHIFT)

/* PUK_REVOKE */
#define OTP_TABLE_PUK_REVOKE_MASK     (0xFF00U)
#define OTP_TABLE_PUK_REVOKE_SHIFT    (0x8U)
#define OTP_TABLE_PUK_REVOKE_SET(x)   (((uint32_t)(x) << OTP_TABLE_PUK_REVOKE_SHIFT) & OTP_TABLE_PUK_REVOKE_MASK)
#define OTP_TABLE_PUK_REVOKE_GET(x)   (((uint32_t)(x) & OTP_TABLE_PUK_REVOKE_MASK) >> OTP_TABLE_PUK_REVOKE_SHIFT)

/* LIFECYCLE_A */
#define OTP_TABLE_LIFECYCLE_A_MASK     (0xFU)
#define OTP_TABLE_LIFECYCLE_A_SHIFT    (0x0U)
#define OTP_TABLE_LIFECYCLE_A_SET(x)   (((uint32_t)(x) << OTP_TABLE_LIFECYCLE_A_SHIFT) & OTP_TABLE_LIFECYCLE_A_MASK)
#define OTP_TABLE_LIFECYCLE_A_GET(x)   (((uint32_t)(x) & OTP_TABLE_LIFECYCLE_A_MASK) >> OTP_TABLE_LIFECYCLE_A_SHIFT)

/* SW_VER */
#define OTP_TABLE_SW_VER_MASK     (0xFFFFFFFFU)
#define OTP_TABLE_SW_VER_SHIFT    (0x0U)
#define OTP_TABLE_SW_VER_SET(x)   (((uint32_t)(x) << OTP_TABLE_SW_VER_SHIFT) & OTP_TABLE_SW_VER_MASK)
#define OTP_TABLE_SW_VER_GET(x)   (((uint32_t)(x) & OTP_TABLE_SW_VER_MASK) >> OTP_TABLE_SW_VER_SHIFT)

/* DIE_TRACE */
#define OTP_TABLE_DIE_TRACE_SHIFT         (0x0U)
#define OTP_TABLE_DIE_TRACE_BIT_LENGTH    (0x80U)

/* DEBUG_KEY */
#define OTP_TABLE_DEBUG_KEY_SHIFT         (0x0U)
#define OTP_TABLE_DEBUG_KEY_BIT_LENGTH    (0x80U)

/* TSNS_BASE */
#define OTP_TABLE_TSNS_BASE_MASK     (0xFFFU)
#define OTP_TABLE_TSNS_BASE_SHIFT    (0x0U)
#define OTP_TABLE_TSNS_BASE_SET(x)   (((uint32_t)(x) << OTP_TABLE_TSNS_BASE_SHIFT) & OTP_TABLE_TSNS_BASE_MASK)
#define OTP_TABLE_TSNS_BASE_GET(x)   (((uint32_t)(x) & OTP_TABLE_TSNS_BASE_MASK) >> OTP_TABLE_TSNS_BASE_SHIFT)

/* TSNS_SLOPE */
#define OTP_TABLE_TSNS_SLOPE_MASK     (0xFFF000U)
#define OTP_TABLE_TSNS_SLOPE_SHIFT    (0xCU)
#define OTP_TABLE_TSNS_SLOPE_SET(x)   (((uint32_t)(x) << OTP_TABLE_TSNS_SLOPE_SHIFT) & OTP_TABLE_TSNS_SLOPE_MASK)
#define OTP_TABLE_TSNS_SLOPE_GET(x)   (((uint32_t)(x) & OTP_TABLE_TSNS_SLOPE_MASK) >> OTP_TABLE_TSNS_SLOPE_SHIFT)

/* CHIP_ID */
#define OTP_TABLE_CHIP_ID_MASK     (0xFFFFFFFFU)
#define OTP_TABLE_CHIP_ID_SHIFT    (0x0U)
#define OTP_TABLE_CHIP_ID_SET(x)   (((uint32_t)(x) << OTP_TABLE_CHIP_ID_SHIFT) & OTP_TABLE_CHIP_ID_MASK)
#define OTP_TABLE_CHIP_ID_GET(x)   (((uint32_t)(x) & OTP_TABLE_CHIP_ID_MASK) >> OTP_TABLE_CHIP_ID_SHIFT)

/* USB_PID */
#define OTP_TABLE_USB_PID_MASK     (0xFFFFU)
#define OTP_TABLE_USB_PID_SHIFT    (0x0U)
#define OTP_TABLE_USB_PID_SET(x)   (((uint32_t)(x) << OTP_TABLE_USB_PID_SHIFT) & OTP_TABLE_USB_PID_MASK)
#define OTP_TABLE_USB_PID_GET(x)   (((uint32_t)(x) & OTP_TABLE_USB_PID_MASK) >> OTP_TABLE_USB_PID_SHIFT)

/* USB_VID */
#define OTP_TABLE_USB_VID_MASK     (0xFFFF0000U)
#define OTP_TABLE_USB_VID_SHIFT    (0x10U)
#define OTP_TABLE_USB_VID_SET(x)   (((uint32_t)(x) << OTP_TABLE_USB_VID_SHIFT) & OTP_TABLE_USB_VID_MASK)
#define OTP_TABLE_USB_VID_GET(x)   (((uint32_t)(x) & OTP_TABLE_USB_VID_MASK) >> OTP_TABLE_USB_VID_SHIFT)

/* PUBLIC_KEY_HASH */
#define OTP_TABLE_PUBLIC_KEY_HASH_SHIFT         (0x0U)
#define OTP_TABLE_PUBLIC_KEY_HASH_BIT_LENGTH    (0x100U)

/* UUID */
#define OTP_TABLE_UUID_SHIFT         (0x0U)
#define OTP_TABLE_UUID_BIT_LENGTH    (0x80U)

/* EXIP0_KEY */
#define OTP_TABLE_EXIP0_KEY_SHIFT         (0x0U)
#define OTP_TABLE_EXIP0_KEY_BIT_LENGTH    (0x100U)

/* MASTER_KEY */
#define OTP_TABLE_MASTER_KEY_SHIFT         (0x0U)
#define OTP_TABLE_MASTER_KEY_BIT_LENGTH    (0x100U)


#endif /* HPM_OTP_TABLE_H */
